﻿<UserControl x:Class="EpiDashboard.DataDictionaryControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:EpiDashboard="clr-namespace:EpiDashboard"
    xmlns:Controls="clr-namespace:EpiDashboard.Controls">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="StyleDictionary.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid Width="768">
        <Border Style="{StaticResource GadgetBorderStyle}">
            <Grid>
                <Grid.ContextMenu>
                    <ContextMenu x:Name="gadgetContextMenu">
                        <MenuItem x:Name="mnuCopy" Header="Copy dictionary data to clipboard"/>
                        <MenuItem x:Name="mnuSendDataToHTML" Header="Send data dictionary to web browser">
                            <MenuItem.Icon>
                                <Image Source="Images/saveHTML.png" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <Separator/>
                        <MenuItem x:Name="mnuSendToBack" Header="Send dictionary to back"/>
                        <MenuItem x:Name="mnuRefresh" Header="Refresh data dictionary">
                            <MenuItem.Icon>
                                <Image Source="Images/refresh1.png" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem x:Name="mnuClose" Header="Close data dictionary"/>
                    </ContextMenu>
                </Grid.ContextMenu>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition />
                </Grid.RowDefinitions>

                <Grid Grid.Row="1">
                    <EpiDashboard:WaitCursor x:Name="waitCursor" Width="25" Height="25" Visibility="Collapsed" StackPanel.ZIndex="99" HorizontalAlignment="Right" VerticalAlignment="Top"/>
                </Grid>

                <DataGrid Grid.Row="1" x:Name="dgMain" MaxHeight="700" Style="{StaticResource LineListDataGridStyle}" AutoGenerateColumns="False">
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="Column Name" Width="250" MaxWidth="250" Binding="{Binding columnname}" IsReadOnly="True" />
                        <DataGridTextColumn Header="Prompt" Width="250" MaxWidth="250" Binding="{Binding Prompt}" IsReadOnly="True">
                            <DataGridTextColumn.ElementStyle>
                                <Style TargetType="TextBlock">
                                    <Setter Property="TextWrapping" Value="Wrap"/>
                                </Style>
                            </DataGridTextColumn.ElementStyle>
                        </DataGridTextColumn>
                        <DataGridTextColumn Header="Form Name" Width="200" MaxWidth="200" Binding="{Binding formname}" IsReadOnly="True" />
                        <DataGridTextColumn Header="Page" Binding="{Binding Page}" IsReadOnly="True" />
                        <DataGridTextColumn Header="Tab" Binding="{Binding Tab}" IsReadOnly="True" />
                        <DataGridTextColumn Header="Data Type" Binding="{Binding datatype}" IsReadOnly="True" />
                        <DataGridTextColumn Header="Epi Field Type" Binding="{Binding FieldType}" IsReadOnly="True" />
                        <DataGridTextColumn Header="Table Name" Width="200" MaxWidth="200" Binding="{Binding tablename}" IsReadOnly="True" />
                        <DataGridTextColumn Header="Items" Width="320" MaxWidth="320" Binding="{Binding Items}" IsReadOnly="True">
                            <DataGridTextColumn.ElementStyle>
                                <Style TargetType="TextBlock">
                                    <Setter Property="TextWrapping" Value="Wrap"/>
                                </Style>
                            </DataGridTextColumn.ElementStyle>
                        </DataGridTextColumn>
                    </DataGrid.Columns>
                </DataGrid>

                <TextBlock Style="{StaticResource GadgetTitleTextStyle}" Grid.Row="0" HorizontalAlignment="Left">Data Dictionary</TextBlock>

                <Controls:CloseButton x:Name="closeButton" Grid.Row="0" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="5" MouseLeftButtonUp="CloseButton_MouseLeftButtonUp"></Controls:CloseButton>

            </Grid>
        </Border>
    </Grid>
</UserControl>
